@extends('front.public_layout.layout')


@section('style')
    <link rel="stylesheet" href="{{asset('/front/css/index.css')}}">

    <link rel="stylesheet" href="{{asset('/front/css/bootstrap4.3.1.min.css')}}">

    <style></style>

@endsection

@section('content')
    @if ($top_width_adv)
        <a class="big-adv" href="{{ $top_width_adv->pc_url }}">
            <img src="{{ $top_width_adv->adv_img_pc_url }}" alt="">
        </a>
    @endif

    <div class="middle-content">

        {{--    分类菜单--}}
        <div class="category-info">
            <a class="c-item chua" href="{{ url('shop') }}" title="市场">
                <img src="{{ url('/front/img/icon/c_shichang.png') }}" alt="">市场
            </a>
            <a class="c-item chua" href="{{ url('technology') }}" title="技术">
                <img src="{{ url('/front/img/icon/c_jishu.png') }}" alt="">技术
            </a>
            <a class="c-item chua" href="{{ url('culture') }}" title="文化">
                <img src="{{ url('/front/img/icon/c_wenhua.png') }}" alt="">文化
            </a>
            <a class="c-item chua" href="{{ url('industry') }}" title="产业">
                <img src="{{ url('/front/img/icon/c_chanye.png') }}" alt="">产业
            </a>
            <a class="c-item chua" href="{{ url('law') }}" title="普法">
                <img src="{{ url('/front/img/icon/c_pufa.png') }}" alt="">普法
            </a>
            <a class="c-item chua" href="{{ url('agriculture') }}" title="兴农">
                <img src="{{ url('/front/img/icon/c_xingnong.png') }}" alt="">兴农
            </a>
            <a class="c-item chua" onclick="waiting_open_tip()" title="植树">
                <img src="{{ url('/front/img/icon/c_zhishu.png') }}" alt="">植树
            </a>
            <a class="c-item chua" onclick="waiting_open_tip()" title="土地认养">
                <img src="{{ url('/front/img/icon/c_tudi.png') }}" alt="">土地认养
            </a>
            <a class="c-item chua" onclick="app_download_tip()" title="问卷调查">
                <img src="{{ url('/front/img/icon/c_wenjuan.png') }}" alt="">问卷调查
            </a>
            <a class="c-item chua" onclick="waiting_open_tip()" title="积分商城">
                <img src="{{ url('/front/img/icon/c_jifenshangcheng.png') }}" alt="">积分商城
            </a>
            <a class="c-item chua" onclick="app_download_tip()" title="邀请好友">
                <img src="{{ url('/front/img/icon/c_yaoqing.png') }}" alt="">邀请好友
            </a>

        </div>

        {{--    广告banner--}}
        @if ($banner_adv)
            <a class="index-adv" href="{{ $banner_adv->pc_url }}">
                <img src="{{ $banner_adv->adv_img_pc_url }}" alt="">
            </a>
        @endif

        {{--    轮播--}}
        <div id="myCarousel" class="carousel inline-block slide" data-ride="carousel">
            <!-- 指示符 -->
            <ul class="carousel-indicators">
                <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                <li data-target="#myCarousel" data-slide-to="1"></li>
                <li data-target="#myCarousel" data-slide-to="2"></li>
            </ul>

            <!-- 轮播图片 -->
            <div class="carousel-inner">

                @foreach ($rotation_adv as $rotationKey => $rotationVal)
                    @if ($rotationKey / 3 == 1 || $rotationKey == 0)
                        <div class="carousel-item {{ $rotationKey == 0 ? 'active' : '' }}">
                    @endif

                        <a class="c-item chua {{ $rotationKey % 3 == 0 ? 'left' : 'right' }}" alt="{{ $rotationVal->adv_name }}" href="{{ $rotationVal->pc_url }}" title="{{ $rotationVal->adv_name }}">
                            <img src="{{ $rotationVal->adv_img_pc_url }}" alt="{{ $rotationVal->adv_name }}" title="{{ $rotationVal->adv_name }}">
                            <div title="{{ $rotationVal->adv_name }}">{{ $rotationVal->adv_name }}</div>
                        </a>

                    @if (($rotationKey + 1) % 3 == 0)
                        </div>
                    @endif

                @endforeach

            </div>

            <!-- 左右切换按钮 -->
            <a class="carousel-control-prev" href="#myCarousel" data-slide="prev">
                <img src="{{ url('/front/img/icon/lunbo_left.png') }}" alt="" title="上一页">
            </a>
            <a class="carousel-control-next" href="#myCarousel" data-slide="next">
                <img src="{{ url('/front/img/icon/lunbo_right.png') }}" alt="" title="下一页">
            </a>
        </div>

        {{--    产业热点--}}
        <div class="new-hot right">
            <div class="n-title">产业热点</div>

            @foreach($chanye_article as $chanyeArticleKey => $chanyeArticleVal)
                @if ($chanyeArticleKey == 0)
                    <a class="new-adv" href="{{ url('article/details/'.$chanyeArticleVal->id) }}"  title="{{ $chanyeArticleVal->article_title }}">
                        <img src="{{ $chanyeArticleVal->list_img_url }}" alt="" title="{{ $chanyeArticleVal->article_title }}">
                        <div class="a-title">
                            <div class="n-hot">HOT</div>
                            <div class="title-info" title="{{ $chanyeArticleVal->article_title }}">{{ $chanyeArticleVal->article_title }}</div>
                        </div>
                    </a>
                @else
                    <div class="new-item">
                        <a title="{{ $chanyeArticleVal->article_title }}" class="new-img" href="{{ url('article/details/'.$chanyeArticleVal->id) }}">
                            <img title="{{ $chanyeArticleVal->article_title }}" src="{{ $chanyeArticleVal->list_img_url }}" alt="">
                        </a>
                        <div class="new-info right">
                            <a title="{{ $chanyeArticleVal->article_title }}" class="new-title" href="{{ url('article/details/'.$chanyeArticleVal->id) }}">
                                {{ $chanyeArticleVal->article_title}}
                            </a>
                            <a title="{{ $chanyeArticleVal->article_title }}" class="new-info" href="{{url('author/'.$chanyeArticleVal->articles_author->id.'/1')}}">
                                {{ $chanyeArticleVal->articles_author->name }}  {{ date('i:s', strtotime($chanyeArticleVal->created_at)) }}
                            </a>
                        </div>
                    </div>
                @endif
            @endforeach

            <a class="news-refresh" href="{{ url('industry') }}" title="查看更多">
                <img src="{{ url('/front/img/icon/more.png') }}" alt="">
                查看更多
            </a>
        </div>

        {{--    农品销售--}}
        <div class="nongping left">
            <a class="index-title" href="{{ url('shop') }}" title="农品销售">
                <img src="{{ url('/front/img/icon/nongping.png') }}" alt="">农品销售
            </a>

            @foreach($goods as $goodsVal)
            <a title="{{ $goodsVal->goods_name }}" class="list-item" href="{{ url('shop/details/'.$goodsVal->id) }}">
                <img title="{{ $goodsVal->goods_name }}" src="{{ $goodsVal->goods_img_url }}" alt="">

                <div class="np-name">{{ $goodsVal->goods_name }}</div>
                <div class="np-price">{{ $goodsVal->acticity_price }} <span>元</span></div>
            </a>
            @endforeach

        </div>

        {{--   技术推荐--}}
        <div class="jishu left">
            <a class="index-title" href="{{ url('technology') }}" title="技术推荐">
                <img  src="{{ url('/front/img/icon/jishu.png') }}" alt="">技术推荐
                <div>更多</div>
            </a>

            @foreach($jishu_article as $jishuArticleKey => $jishuArticleVal)
                @if ($jishuArticleKey == 0)
                    <a title="{{ $jishuArticleVal->article_title }}" class="js-adv" href="{{ url('article/details/'.$jishuArticleVal->id) }}">
                        <div class="js-img"><img title="{{ $jishuArticleVal->article_title }}" src="{{ $jishuArticleVal->list_img_url }}" alt=""></div>
                        <div>{{ $jishuArticleVal->article_title }}</div>
                    </a>
                @else
                    <a class="js-item chua" href="{{ url('article/details/'.$jishuArticleVal->id) }}" title="{{ $jishuArticleVal->article_title }}">
                        <div>{{ $jishuArticleVal->article_title }}</div>
                        <span>{{ date('m-d', strtotime($jishuArticleVal->created_at)) }}</span>
                    </a>
                @endif
            @endforeach

        </div>

        {{--   普法--}}
        <div class="jishu left">
            <a class="index-title" href="{{ url('law') }}" title="普法">
                <img src="{{ url('/front/img/icon/pufa.png') }}" alt="">普法
                <div>更多</div>
            </a>

            @foreach($pufa_article as $pufaArticleKey => $pufaArticleVal)
                @if ($pufaArticleKey == 0)
                    <a title="{{ $pufaArticleVal->article_title }}" class="js-adv" href="{{ url('article/details/'.$pufaArticleVal->id) }}">
                        <div class="js-img"><img title="{{ $pufaArticleVal->article_title }}" src="{{ $pufaArticleVal->list_img_url }}" alt=""></div>
                        <div>{{ $pufaArticleVal->article_title }}</div>
                    </a>
                @else
                    <a title="{{ $pufaArticleVal->article_title }}" class="js-item chua" href="{{ url('article/details/'.$pufaArticleVal->id) }}">
                        <div>{{ $pufaArticleVal->article_title }}</div>
                        <span>{{ date('m-d', strtotime($pufaArticleVal->created_at)) }}</span>
                    </a>
                @endif
            @endforeach
        </div>

        {{--   发现--}}
        <div class="find-video clear">
            <div class="index-title">
                <img src="{{ url('/front/img/icon/faxian.png') }}" alt="">发现
            </div>

            <a class="more" href="{{ url('find') }}" title="查看更多">查看更多
                <img src="{{ url('/front/img/icon/more.png') }}" alt="">
            </a>

            <div class="video-list">

                @foreach($video_article as $videoArticle)
                <div class="v-item">
                    <a href="{{ url('article/details/'.$videoArticle->id) }}" title="{{ $videoArticle->article_title }}">
                        <div class="v-img">
                            <img title="{{ $videoArticle->article_title }}" src="{{ $videoArticle->list_img_url }}" alt="">
                            <div class="v-info">
                                <div class="v-i-play">{{ $videoArticle->read_num }}</div>
                                <div class="v-i-zan">{{ $videoArticle->zan_num }}</div>
                                <div class="v-i-time">{{ date('m-d', strtotime($videoArticle->created_at)) }}</div>
                            </div>
                        </div>

                        <div class="v-title">{{ $videoArticle->article_title }}</div>
                    </a>

                    <a title="{{ $videoArticle->article_title }}" class="zuozhe" href="{{url('author/'.$videoArticle->articles_author->id.'/1')}}">
                        <img title="{{ $videoArticle->article_title }}" src="{{ $videoArticle->articles_author->avatar_url }}" alt="">
                        <div>{{ $videoArticle->created_at }}</div>
                    </a>
                </div>
                @endforeach



            </div>
        </div>

        {{--   我的村--}}
        <div class="my-village">
            {{--   民情反馈--}}
            <div class="village-left">
                <div class="index-title">
                    <img src="{{ url('/front/img/icon/village.png') }}" alt="">我的村
                </div>
                <div class="village">
                    <div class="mail-box">
                        <div class="n-title">民情反馈</div>
                        <div class="fk-leixing">
                            <div class="active">遇到问题</div>
                            <div>提供建议</div>
                        </div>

                        <textarea name="" id="" cols="30" rows="10" disabled placeholder="请详细描述你遇到的问题或建议"></textarea>

                        <div class="submit-mail-btn" onclick="app_download_tip()">提交</div>

                        <div class="n-title">书记信箱</div>

                        <div class="img-b">
                            <a onclick="app_download_tip()">
                                <img src="{{ url('/front/img/icon/zhuanlan_btn.png') }}" alt="" class="img-btn">
                            </a>
                            <a onclick="app_download_tip()">
                                <img src="{{ url('/front/img/icon/xin_btn.png') }}" alt="" class="img-btn">
                            </a>
                            <a onclick="app_download_tip()">
                                <img src="{{ url('/front/img/icon/laixin_btn.png') }}" alt="" class="img-btn">
                            </a>
                        </div>

                    </div>

                </div>

            </div>

            {{--   右半部分--}}
            <div class="village-right right">
                <div class="title-model">
                    <a title="村务" class="index-title checked" href="{{ url('village_notice') }}">
                        <img src="{{ url('/front/img/icon/cunwu_check.png') }}" alt="">村务
                    </a>

                    <a title="党务" class="index-title" href="{{ url('village_party') }}">
                        <img src="{{ url('/front/img/icon/dangwu.png') }}" alt="">党务
                    </a>

                    <a title="政策" class="index-title" href="{{ url('village_policy') }}">
                        <img src="{{ url('/front/img/icon/zhengce.png') }}" alt="">政策
                    </a>
                </div>

                @foreach($cunwu_article as $cunwuArticleKey => $cunwuArticleVal)
                    <a title="{{ $cunwuArticleVal->article_title }}" class="cunwu-new" href="{{ url('article/details/'.$cunwuArticleVal->id) }}">
                        <div class="cunwu-img">
                            <img title="{{ $cunwuArticleVal->article_title }}" src="{{ $cunwuArticleVal->list_img_url }}" alt="">
                        </div>

                        <div class="new-info right">
                            <div class="title">【{{ $cunwuArticleVal->region_info->region_name }}】{{ $cunwuArticleVal->article_title }}</div>
                            <div class="info">
                                {{ $cunwuArticleVal->content_into }}
                            </div>
                        </div>
                    </a>
                @endforeach

                <div class="second-item">
                    <a title="公告通知" class="index-second-title checked" href="{{ url('village_notice') }}">
                        公告通知
                        <img src="{{ url('/front/img/icon/more.png') }}" alt="">
                    </a>

                    @foreach($tongzhi_article as $tongzhiArticleKey => $tongzhiArticleVal)
                        @if ($tongzhiArticleKey == 0)
                            <a class="first-img" href="{{ url('article/details/'.$tongzhiArticleVal->id) }}" title="{{ $tongzhiArticleVal->article_title }}">
                                @if ($tongzhiArticleVal->all_img_url)
                                    @foreach($tongzhiArticleVal->all_img_url as $tongzhiImgsKey => $tongzhiImgsVal)
                                        @if ($tongzhiImgsKey < 2)
                                        <div><img title="{{ $tongzhiArticleVal->article_title }}" src="{{ $tongzhiImgsVal }}" alt=""></div>
                                        @endif
                                    @endforeach
                                @endif
                                <span>【{{ $tongzhiArticleVal->region_info->region_name }}】{{ $tongzhiArticleVal->article_title }}</span>
                            </a>
                        @else
                            <a title="{{ $tongzhiArticleVal->article_title }}" class="js-item chua" href="{{ url('article/details/'.$tongzhiArticleVal->id) }}">
                                <div>【{{ $tongzhiArticleVal->region_info->region_name }}】{{ $tongzhiArticleVal->article_title }}</div>
                                <span>{{ date('m-d', strtotime($tongzhiArticleVal->created_at)) }}</span>
                            </a>
                        @endif

                    @endforeach

                </div>

                <div class="second-item right">
                    <a class="index-second-title" href="{{ url('village_things') }}" title="大事小情">
                        大事小情
                        <img  src="{{ url('/front/img/icon/more.png') }}" alt="">
                    </a>

                    @foreach($things_data as $thingsDataKey => $thingsDataVal)
                        @if ($thingsDataKey == 0)
                            <a title="{{ $thingsDataVal->content }}" class="first-img chua" href="{{ url('village_things/details/'.$thingsDataVal->id) }}">
                                @if ($thingsDataVal->imgs_url)
                                    @foreach($thingsDataVal->imgs_url as $thingsImgsKey => $thingsImgsVal)
                                        @if ($thingsImgsKey < 2)
                                            <div><img src="{{ $thingsImgsVal }}" alt=""></div>
                                        @endif
                                    @endforeach

                                @else
                                    <div><img title="{{ $thingsDataVal->content }}" src="{{ $thingsDataVal->video_img_url }}" alt=""></div>
                                @endif
                                <span>【{{ $thingsDataVal->region_info->region_name }}】{{ $thingsDataVal->content }}</span>
                            </a>
                        @else
                            <a title="{{ $thingsDataVal->content }}" class="js-item chua" href="{{ url('village_things/details/'.$thingsDataVal->id) }}">
                                <div>【{{ $thingsDataVal->region_info->region_name }}】{{ $thingsDataVal->content }}</div>
                                <span>{{ date('m-d', strtotime($thingsDataVal->created_at)) }}</span>
                            </a>
                        @endif

                    @endforeach


                </div>

            </div>
            <div class="clear"></div>
        </div>

        {{--   服务--}}
        <div class="service clear">
            <div class="index-title">
                <img src="{{ url('/front/img/icon/fuwu.png') }}" alt="">服务
            </div>

            <div class="gongzheng">

                <div class="inline-block">
                    <a class="index-second-title inline-block checked" title="公证服务">
                        公证服务
                    </a>
                    <div class="gongzheng-mode">
                        <img title="办公证" src="{{ url('/front/img/icon/gz_bangong.png') }}" alt="" onclick="waiting_open_tip()">
                        <img title="请律师" src="{{ url('/front/img/icon/gz_lvshi.png') }}" alt="" onclick="waiting_open_tip()">
                        <img title="找帮主" src="{{ url('/front/img/icon/gz_bangzhu.png') }}" alt="" onclick="waiting_open_tip()">
                        <img title="案例库" src="{{ url('/front/img/icon/gz_anli.png') }}" alt="" onclick="waiting_open_tip()">
                    </div>
                </div>


                <div class="gongzheng-item right">
                    <div class="item" onclick="waiting_open_tip()">
                        <div class="title">出生公证</div>
                        <img title="出生公证" src="{{ url('/front/img/icon/gz_chusheng.png') }}" alt="">
                    </div>
                    <div class="item" onclick="waiting_open_tip()">
                        <div class="title">护照公证</div>
                        <img title="护照公证" src="{{ url('/front/img/icon/gz_huzhao.png') }}" alt="">
                    </div>
                </div>
            </div>

            <a class="nognye" href="{{ url('reservation') }}" title="农业服务">
                <div class="index-second-title">
                    农业服务
                    <img src="{{ url('/front/img/icon/more.png') }}" alt="">
                </div>
                <img title="专业农业知道服务" src="{{ url('/front/img/icon/nongye.png') }}" class="adv-img" alt="">
            </a>

            <div class="things">
                <a class="index-second-title" href="{{ url('village_publish') }}" title="农品助力">
                    农品助力
                    <img src="{{ url('/front/img/icon/more.png') }}" alt="">
                </a>
                <a class="things-item" href="{{ url('village_publish/details/'.$publish_data->id) }}"  title="{{ $publish_data->pub_title }}">
                    <div class="author">
                        <img src="{{ $publish_data->auther['img'] }}" alt="">
                        <div class="info">
                            <div>{{ $publish_data->auther['name'] }}</div>
                            <div>{{ $publish_data->created_at }}</div>
                        </div>
                    </div>
                    <div class="title">{{ $publish_data->pub_title }}</div>
                    <div class="t-info">{{ $publish_data->content_into }}</div>
                    <div class="things-img">
                        @if (count($publish_data->imgs_url))
                        @foreach($publish_data->imgs_url as $publishImgsKey => $publishImgsVal)
                            @if ($publishImgsKey < 3)
                                <div><img src="{{ $publishImgsVal }}" alt=""></div>
                            @endif
                        @endforeach

                        @else
                            <div><img src="{{ $publish_data->list_img_url }}" alt=""></div>
                        @endif
                    </div>
                </a>
            </div>
        </div>
    </div>
@endsection


@section('js')

    <script src="{{asset('front/js/bootstrap4.3.1.min.js')}}"></script>
    <script>
        $('.carousel').carousel({
            interval: 5000,
            pause: '',
            wrap:true
        })

        {{--get_adv_data(9, '{{ csrf_token() }}', 20)--}}
    </script>
@endsection